<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    //时间单位是ms
    //定时器1 超时定时器

    var t1 = setTimeout(function(){
        console.log('3秒到了');
    },3000)
    //定时器2 间隔定时器
    var t2 = setInterval(function(){
        console.log('1秒到了');
    },1000)
    //如果想要关闭定时器怎么办
    clearTimeout(t1)
    clearInterval(t2)
    //如何定时1秒输出1到9
    var i=1;
    var t3=setInterval(function(){
        console.log
        if(i>9){
            //关闭定时器
            
        }
    })

    </script>
</body>
</html>